﻿using BCDto.Common.ErrorMessage;
using BCDto.TMS.Driver;
using BCDto.TMS.Driver.VehicleBusiness;
using BCService.TMS.Driver;
using BCTMSRESTful.Configs;
using Microsoft.AspNetCore.Mvc;
using System;

namespace BCTMSRESTful.Controllers.DriverApp.Driver
{
    /// <summary>
    /// 司机端骑手接口信息
    /// </summary>
    [ApiExplorerSettings(GroupName = "DriverApp")]
    [Route("api/v1/DriverApp/[controller]")]
    public class HorsemanController : DriverAppBaseController
    {
        private readonly TimeSpan expiration = TimeSpan.FromDays(1);
        private readonly IDriverService driverService;

        public HorsemanController(IDriverService driverService)
        {
            this.driverService = driverService;
        }

        #region 车辆信息

        /// <summary>
        /// 上传电动车辆信息
        /// </summary>
        /// <param name="dto">电动车辆信息</param>
        /// <returns></returns>
        /// <response code="200">上传电动车辆信息提交成功。</response>
        /// <response code="400">请求参数或输入的数据不正确。</response>
        /// <response code="401">请求需要认证或者认证信息已过期。</response>
        /// <response code="500">服务器内部错误。</response>
        [HttpPost("[action]")]
        [Log("上传电动车辆信息")]
        [ProducesResponseType(typeof(DriverDto), 200)]
        [ProducesResponseType(typeof(ErrorMessageDto), 400)]
        [ProducesResponseType(typeof(ErrorMessageDto), 500)]
        public IActionResult UploadElectricVehicle([FromBody] ElectricVehicleRequestDto dto)
        {
            var driver = this.driverService.UploadElectricVehicle(this.Driver.DriverId, dto);
            return Ok(driver);
        }

        #endregion      


    }
}
